//
//  AddressCell.m
//  FinancialProduct
//
//  Created by Stella on 2017/9/9.
//  Copyright © 2017年 maq. All rights reserved.
//

#import "AddressCell.h"

@implementation AddressCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self.mTextField addTarget:self action:@selector(textFieldDidEndEditing:) forControlEvents:UIControlEventEditingDidEnd];
    [self.mTextField addTarget:self action:@selector(textFieldDidEditingChange:) forControlEvents:UIControlEventEditingChanged];
}
- (IBAction)chooseCity:(id)sender {
    if (self.chooseReturn) {
        self.chooseReturn();
    }
}
-(void)textFieldDidEditingChange:(UITextField *)textField{
    switch (textField.tag) {
        case 1:
            break;
        case 3:
        {
            if (textField.text.length>100) {
                textField.text = [textField.text substringToIndex:100];
            }
        }
            break;
        case 2:
            break;
        case 4:
        {
            if (textField.text.length>20) {
                textField.text = [textField.text substringToIndex:20];
            }
        }
            break;
            
        default:
            break;
    }


}
-(void)textFieldDidEndEditing:(UITextField *)textField{
    if (self.returnTextBlock) {
        self.returnTextBlock(textField.text);
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
